[LSP pull diagnostics] Handle background analysis scope options for both compiler and analyzer diagnostics#68818
Merged
mavasani merged 4 commits intodotnet:mainfrom Jun 30, 2023
Merged
Conversation
…oth compiler and analyzer diagnostics Fixes [AB#1815692](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1815692) Fixes dotnet#68797 Currently, enabling FSA for either compiler or analyzer diagnostics computes and reports full solution diagnostics for both compiler and analyzers. We need to trigger FSA for selected analyzers (compiler and/or other analyzers) based on both options. For optimal performance, this is done as a pre-filtering of analyzers to execute rather than post-filtering of diagnostics reported from both compiler and analyzers.
mavasani
commented
Jun 28, 2023
Comment on lines
+305
to
+308
| if (_shouldIncludeAnalyzer != null && !_shouldIncludeAnalyzer(stateSet.Analyzer)) | ||
| { | ||
| return false; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
This is the core fix. Most of the other changes in the PR are just threading through this func.
mavasani
commented
Jun 28, 2023
Comment on lines
+192
to
+193
| Func<DiagnosticAnalyzer, bool>? shouldIncludeAnalyzer = !compilerFullSolutionAnalysisEnabled || !analyzersFullSolutionAnalysisEnabled | ||
| ? ShouldIncludeAnalyzer : null; |
Contributor
Author
There was a problem hiding this comment.
This is the only place where the delegate is passed in to skip analyzers.
…d analyzer diagnostic scope options. Default the compiler diagostic scope to match the provided analyzer diagnostic scope, with the tests being able to provide an explicit compiler diagnostic scope.
sharwell
approved these changes
Jun 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes AB#1815692
Fixes #68797
Currently, enabling FSA for either compiler or analyzer diagnostics computes and reports full solution diagnostics for both compiler and analyzers. We need to trigger FSA for selected analyzers (compiler and/or other analyzers) based on both options. For optimal performance, this is done as a pre-filtering of analyzers to execute rather than post-filtering of diagnostics reported from both compiler and analyzers.
NOTE: dotnet/vscode-csharp#5872 tracks corrupt diagnostics being reported for non-source documents when full solution analysis is enabled.
With this PR + dotnet/vscode-csharp#5868: